package com.zzl.springboot_mybatis_demo.listener;

import com.zzl.springboot_mybatis_demo.task.CancelOrderTask;
import org.quartz.SchedulerException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * description: 取消订单监听器（监听失效订单并将其关闭）
 * @author 朱正磊
 * @date 2020-06-20 20:58:27
 */
@WebListener
public class CancelOrderListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        CancelOrderTask task = new CancelOrderTask();
        try {
            task.cancelOrderTask();
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }

}
